﻿<style>
    #tab.table > thead > tr > th, #tab.table > tbody > tr > th, #tab.table > tfoot > tr > th, #tab.table > thead > tr > td, #tab.table > tbody > tr > td, #tab.table > tfoot > tr > td {
        vertical-align: middle;
        text-align: center;
    }

    .default-tab input, .default-tab select {
        border: none;
        box-shadow: none !important;
    }

    a .iconfont {
        margin-right: 5px;
        font-size: 12px;
    }
</style>
<div class="form-horizontal" ms-controller="SRMX">

    <div style="margin: 0 80px;">
        <div>
            <ul class="clearfix" style="display: block;padding:0">
                <li class="add-item add-width">
                    <label class="add-item-label">单位</label>
                    <div class="add-ic">
                        <div class="input-group ">
                            <input type="text" class="form-control" autocomplete="off" isinit="Y" onfocus="this.blur()" ms-duplex="modelData.dwname" step="WIDTH: 300PX;">
                            <span class="input-group-addon" style="height:34px;" ms-click="seldw()"> 选择单位</span>
                        </div>
                     
                    </div>
                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>项目期别</label>
                    <div class="add-ic">
                        <select name="conType" id="conType" ms-duplex="modelData.xmqbid" class="form-control szhl_require">
                            <option value="">请选择</option>
                            <option ms-repeat-item="xmqb" ms-attr-value="item.ID">{{item.Remark1}}--{{item.Remark2}}</option>
                        </select>
                    </div>
                </li>

                <li class="add-item add-width  fl-right">
                    <label class="add-item-label">计划科目</label>
                    <div class="add-ic">
                        <div class="input-group ">
                            <input type="text" class="form-control" autocomplete="off" isinit="Y" onfocus="this.blur()" ms-duplex="modelData.Name"  id="jhsxname"  step="    WIDTH: 300PX;">

                            <span class="input-group-addon" style="height:34px;" ms-click="seljhsx()"> 选择计划科目</span>
                        </div>
                    </div>

                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>产品类型</label>
                    <div class="add-ic">
                        <select ms-duplex="modelData.cplxid" class="form-control">
                            <option value="">请选择</option>
                            <option ms-repeat-item="cplx" ms-attr-value="item.ID">{{item.TypeName}}</option>
                        </select>
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label"><i>*</i>回款类型</label>
                    <div class="add-ic">
                        <select ms-duplex="modelData.hklxid" class="form-control">
                            <option value="">请选择</option>
                            <option ms-repeat-item="hklx" ms-attr-value="item.ID">{{item.TypeName}}</option>
                        </select>
                    </div>
                </li>
            
                <li class="add-item add-widthall">
                    <div class="default-tab ft14 ">
                        <table class="table table-hover table-bordered" id="tab">
                            <thead style="background:#f7f7f7;">
                                <tr>
                                    <th width="100px">分月计划</th>
                                    <th width="150px">金额(元)</th>
                                    <th width="150px" colspan="3">描述</th>

                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        第一月
                                    </td>
                                    <td><input type="text" class="form-control yje" ms-duplex="modelData.je1" placeholder="请输入金额" /></td>

                                    <td colspan="3"><input type="text" class="form-control" ms-duplex="modelData.je1dec" placeholder="请输入描述" /></td>
                                </tr>
                                <tr>
                                    <td>
                                        第二月
                                    </td>
                                    <td><input type="text" class="form-control yje" ms-duplex="modelData.je2" placeholder="请输入金额" /></td>

                                    <td colspan="3"><input type="text" class="form-control" ms-duplex="modelData.je2dec" placeholder="请输入描述" /></td>
                                </tr>
                                <tr>
                                    <td>
                                        第三月
                                    </td>
                                    <td><input type="text" class="form-control yje" ms-duplex="modelData.je3" placeholder="请输入金额" /></td>

                                    <td colspan="3"><input type="text" class="form-control" ms-duplex="modelData.je3dec" placeholder="请输入描述" /></td>
                                </tr>
                                <tr>
                                    <td>金额小计</td><td><input type="text" ms-duplex="modelData.jexj" maxlength="400" class="form-control szhl_require" /></td>
                                    <td colspan="3"><input type="text" class="form-control" ms-duplex="modelData.remark" placeholder="请输入备注" /></td>
                                </tr>
                                <tr>
                                    <td>
                                        按周分解
                                    </td>
                                    <td>
                                        第一周
                                    </td>
                                    <td>
                                        第二周
                                    </td>
                                    <td>
                                        第三周
                                    </td>
                                    <td>
                                        第四周
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        周金额
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" ms-duplex="modelData.week1" placeholder="请输入金额" />
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" ms-duplex="modelData.week2" placeholder="请输入金额" />
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" ms-duplex="modelData.week3" placeholder="请输入金额" />
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" ms-duplex="modelData.week4" placeholder="请输入金额" />
                                    </td>
                                </tr>
                            </tbody>

                        </table>
                    </div>
                </li>


            </ul>
        </div>

    </div>


</div>
<script>
    var tempmodel = avalon.define({
        $id: "SRMX",
        name: "收入明细",
        modelData: { "JHID": "", "xmqbid": "", "jhsxid": "", "cplxid": "", "Name":"", "hklxid": "", "zxje": "0", "jexj": "0", "je1": "0", "je2": "0", "je3": "0", "je1dec": "", "je2dec": "", "je3dec": "", "remark": "", "week1": "0", "week2": "0", "week3": "0", "week4": "0", "dwname": "", "dwid": "", "status": "0", "intProcessStanceid": "0" },
        jhdata: {},
        iswf: false,//是否属于流程表单
        cplx: [],
        hklx: [],
        xmqb: [],
        dwdata: {},
        seldw: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/XTGL/BranchSelect.html", "选择单位", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var branch = top.$("#" + frameid)[0].contentWindow.getselectedbranch();
                tempmodel.modelData.dwid = branch.branchid;
                tempmodel.modelData.dwname = branch.branchname;
           
                $.post("/API/VIEWAPI.ashx?ACTION=JHSR_GETMXMQB", { P1: branch.branchid }, function (result) {
                    tempmodel.xmqb = result.Result1;
                });

                top.layer.close(index)

            })
        },
        seljhsx: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/JHZD/JHSXSelect.html?iszf=Y", "选择计划科目", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var datainfo = ComFunJS.isIE() ? top.window.frames[frameid].getselecteddata() : top.$("#" + frameid)[0].contentWindow.getselecteddata();
                tempmodel.modelData.jhsxid = datainfo.dataid;
                tempmodel.modelData.Name = datainfo.dataname;

                $("#jhsxname").val(datainfo.dataname)
                top.layer.close(index)
            })
        },
        inittemp: function (strId) {

            $(".yje").change(function () {
                tempmodel.modelData.jexj = tempmodel.modelData.je1 * 1 + tempmodel.modelData.je2 * 1 + tempmodel.modelData.je3 * 1;
            })


            $.getJSON('/API/VIEWAPI.ashx?Action=JHSR_GETMXINITDATA', { P1: ComFunJS.getQueryString("JHID", "0") }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.jhdata = resultData.Result[0];
                    tempmodel.modelData.JHID = tempmodel.jhdata.ID;
                    tempmodel.xmqb = resultData.Result1;
                    tempmodel.hklx = resultData.Result2;
                    tempmodel.cplx = resultData.Result3;
                    tempmodel.dwdata = resultData.Result4;
                    tempmodel.modelData.dwid = tempmodel.dwdata.DeptCode;
                    tempmodel.modelData.dwname = tempmodel.dwdata.DeptName;

                    if (strId) {
                        //编辑加载数据
                        $.getJSON('/API/VIEWAPI.ashx?Action=JHSR_GETMODEL', { P1: strId }, function (result) {
                            if (result.ErrorMsg == "") {
                                tempmodel.modelData = result.Result;
                                setTimeout(" ComFunJS.initForm()", 500)
                            }
                        })
                    } else {
                        ComFunJS.initForm()
                    }
                }
            })



        },//初始化
        SaveData: function (callback) {
            $.post("/API/VIEWAPI.ashx?ACTION=JHSR_ADDJHMXSR", { P1: JSON.stringify(tempmodel.modelData.$model) }, function (result) {
                return callback.call(this, result);
            });
        },
        Complate: function () {
            tempmodel.modelData.xmqbid = "";
           
        }
    })
    

    ;//# sourceURL=JHSR.js;
</script>